<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>

  <textarea name="" id="text1" cols="30" rows="10"></textarea>
  <input type="button" name="" id="btn1" value="过滤">
  <textarea name="" id="text2" cols="30" rows="10"></textarea>


  <script>
    window.onload = function() {
      let text1 = document.getElementById('text1')
      let text2 = document.getElementById('text2')
      let oBtn = document.getElementById('btn1')

      oBtn.onclick = function() {
        // | 表示或者的意思
        const re = /百度|淘宝|新浪/g

        text2.value = text1.value.replace(re, '***')
      }
    }
    
  </script>
</body>
</html>